package com.common.optional;

import java.util.Optional;

public class OptionalDemo1 {

    public static void main(String[] args) {
        OptionDemo1Bean demo1Bean = new OptionDemo1Bean("测试");
        Optional<OptionDemo1Bean> optionDemo1Bean = Optional.of(demo1Bean);
        Optional<String> optionalS= optionDemo1Bean.map(OptionDemo1Bean::getDesc);
        demo1Bean.setDesc(optionalS.orElse("op修改值"));
        System.out.println(demo1Bean);
    }
}
